package com.company.project.service.impl;

import com.company.project.dao.ReportEquipmentMapper;
import com.company.project.model.ReportEquipment;
import com.company.project.model.dto.getAllReportEquipmentDto;
import com.company.project.model.dto.getkhdwDto;
import com.company.project.service.ReportEquipmentService;
import com.company.project.core.AbstractService;
import io.swagger.models.auth.In;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * Created by DLHTX on 2020/06/17.
 */
@Service
@Transactional
public class ReportEquipmentServiceImpl extends AbstractService<ReportEquipment> implements ReportEquipmentService {
    @Resource
    private ReportEquipmentMapper reportEquipmentMapper;


    @Override
    public List<ReportEquipment> getAllReportEquipment(getAllReportEquipmentDto param) {
        return reportEquipmentMapper.getAllReportEquipment(param);
    }

    @Override
    public List<getkhdwDto> getKhdwPie() {
        return reportEquipmentMapper.getKhdwPie();
    }

    @Override
    public List<getkhdwDto> getsalesmanPie() {
        return reportEquipmentMapper.getsalesmanPie();
    }

    @Override
    public List<getkhdwDto> getbackdriverPie() {
        return reportEquipmentMapper.getbackdriverPie();
    }

    @Override
    public List<getkhdwDto> getsbxhPie() {
        return reportEquipmentMapper.getsbxhPie();
    }

    @Override
    public int updateReportEquipment(String BaseSql) {
        return reportEquipmentMapper.updateReportEquipment(BaseSql);
    }

    @Override
    public List<ReportEquipment> getWork_id() {
        return reportEquipmentMapper.getWork_id();
    }

    @Override
    public int addReportEquipment(ReportEquipment reportEquipment) {
        return reportEquipmentMapper.insertSelective(reportEquipment);
    }

    @Override
    public List<ReportEquipment> searchCommonFunction(String param) {
        return reportEquipmentMapper.searchCommonFunction(param);
    }

    @Override
    public List<ReportEquipment> getAllReportEquipmentNoWhere() {
        ReportEquipment reportEquipment = new ReportEquipment();
        reportEquipment.setIs_delete(0);
        return reportEquipmentMapper.select(reportEquipment);
    }

    @Override
    public int deleteEquipmentByid(ReportEquipment reportEquipment) {
        reportEquipment.setIs_delete(1);
        return reportEquipmentMapper.updateByPrimaryKeySelective(reportEquipment);//根据主键更新属性不为null的值
    }

    @Override
    public int updateDispatch(ReportEquipment reportEquipment) {
        reportEquipment.setAccount_state("未预算");
        return reportEquipmentMapper.updateByPrimaryKeySelective(reportEquipment);//根据主键更新属性不为null的值
    }

    @Override
    public int updateBudget(ReportEquipment reportEquipment) {
        reportEquipment.setAccount_state("未结算");
        return reportEquipmentMapper.updateByPrimaryKeySelective(reportEquipment);//根据主键更新属性不为null的值
    }

    @Override
    public int updateAccount(ReportEquipment reportEquipment) {
        return reportEquipmentMapper.updateByPrimaryKeySelective(reportEquipment);//根据主键更新属性不为null的值
    }


}
